/* 基础样式 */
.training-platform {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* 添加相对定位 */
    position: relative;
}

/* 新增侧边栏样式 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background-color: #1a202c;
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-header .logo {
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.new-chat-btn {
    background-color: #2b6cb0;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: #3182ce;
}

.lab-history {
    padding: 15px 10px;
    border-bottom: 1px solid #2d3748;
}

.lab-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.lab-item:hover {
    background-color: #2d3748;
}

.lab-item.active {
    background-color: #2b6cb0;
}

.lab-item i {
    margin-right: 10px;
    font-size: 0.9rem;
}

.lab-item .truncate {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lab-item .time {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-left: 10px;
}

.section-title {
    font-size: 0.8rem;
    color: #a0aec0;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding: 0 15px;
}

.sidebar-menu {
    flex: 1;
    padding: 10px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #2d3748;
}

.menu-item.active {
    background-color: #2b6cb0;
}

.menu-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

/* 子菜单样式 */
.submenu {
    background-color: #2d3748;
}

.submenu-item {
    padding: 10px 20px 10px 40px;
    font-size: 0.9rem;
}

.submenu-item i {
    margin-right: 10px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #2d3748;
}

.progress-summary {
    text-align: center;
}

.progress-text {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.progress-bar {
    height: 8px;
    background-color: #2d3748;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background-color: #3182ce;
    border-radius: 4px;
}

.completion-rate {
    font-size: 0.8rem;
    color: #a0aec0;
}

/* 调整容器样式以适应侧边栏 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    /* 添加左侧边距以避开固定侧边栏 */
    margin-left: 280px;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
    /* 添加顶部边距以避开头部 */
    margin-top: 5px;
}

/* 头部样式 */
.platform-header {
    background-color: #1a202c;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    /* 修改定位使其位于侧边栏右侧 */
    margin-left: 260px;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 99;
}

.logo {
    margin: 0;
    font-size: 1.5rem;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    color: #e2e8f0;
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #4299e1;
}

/* 页面标题区 */
.page-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
}

.page-title {
    margin: 0 0 0.5rem 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.progress-indicator {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e2e8f0;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: #4a5568;
}

/* 卡片样式 */
.instructions-card, .hints-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    background-color: #2b6cb0;
    color: white;
    padding: 1rem;
    cursor: pointer; /* 添加手型光标表示可点击 */
}

.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header:hover {
    background-color: #2c5282; /* 悬停效果 */
}

.card-body {
    padding: 1rem;
    line-height: 1.6;
    background-color: #e3f4ff;
}

/* 靶场内容区 */
.lab-container {
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    margin-bottom: 2rem;
    overflow: hidden;
}

.lab-content {
    padding: 1.5rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #4a5568;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 0.375rem;
    font-size: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    border-radius: 0.375rem;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3182ce;
    color: white;
}

.btn-primary:hover {
    background-color: #2b6cb0;
}

/* 结果和日志样式 */
.result-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

#query-log {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.375rem;
    font-family: monospace;
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    min-height: 20px;
}

.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #f0fff4;
    border: 1px solid #c6f6d5;
    color: #22543d;
}

.alert-danger {
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
}

/* FLAG 显示样式 */
.flag-reveal {
    background-color: #fff380;
    border: 2px dashed #ffc107;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.flag-value {
    font-family: monospace;
    font-size: 1.25rem;
    color: #856404;
    font-weight: bold;
    text-align: center;
    padding: 0.5rem;
}

/* 页脚样式 */
.platform-footer {
    background-color: #1a202c;
    color: #e2e8f0;
    padding: 2rem 0;
    margin-top: auto;
    margin-left: 260px;
}

/* 错误消息 */
.error-message {
    color: #c53030;
    background-color: #fff5f5;
    padding: 1rem;
    border-radius: 0.375rem;
    text-align: center;
}

/* 统计信息样式 */
.stats-title {
    font-size: 0.9rem;
    color: #a0aec0;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.stats-label {
    font-size: 0.9rem;
}

.stats-value {
    font-weight: bold;
}

.stats-value.success {
    color: #48bb78;
}

.stats-value.failed {
    color: #e53e3e;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .page-header h2 {
        font-size: 1.5rem;
    }

    .main-nav ul {
        gap: 1rem;
    }

    /* 在小屏幕上隐藏侧边栏 */
    .sidebar {
        display: none;
    }

    .container,
    .platform-header,
    .platform-footer {
        margin-left: 0;
    }

    .main-content {
        margin-top: 0;
    }
}